1 #region Using Statements
3 using System.Collections.Generic;
4 using Microsoft.Xna.Framework;
5 using Microsoft.Xna.Framework.Content;
6 using Microsoft.Xna.Framework.Graphics;
7 using Microsoft.Xna.Framework.Input;
8 using Microsoft.Xna.Framework.Storage;
9 using Microsoft.Xna.Framework.GamerServices;
13 namespace SuperPolarity
16 /// This is the main type for your game
18 public class SuperPolarity : Game
20 public static GraphicsDeviceManager graphics;
21 SpriteBatch spriteBatch;
23 public SuperPolarity()
26 SuperPolarity.graphics = new GraphicsDeviceManager(this);
27 SuperPolarity.graphics.PreferMultiSampling = true;
28 Content.RootDirectory = "Content";
29 ActorFactory.SetContentManager(Content);
33 /// Allows the game to perform any initialization it needs to before starting to run.
34 /// This is where it can query for any required services and load any non-graphic
35 /// related content. Calling base.Initialize will enumerate through any components
36 /// and initialize them as well.
38 protected override void Initialize()
44 /// LoadContent will be called once per game and is the place to load
45 /// all of your content.
47 protected override void LoadContent()
49 // Create a new SpriteBatch, which can be used to draw textures.
50 spriteBatch = new SpriteBatch(GraphicsDevice);
52 Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
54 ActorFactory.CreateMainShip(playerPosition);
58 /// UnloadContent will be called once per game and is the place to unload
61 protected override void UnloadContent()
63 // TODO: Unload any non ContentManager content here
67 /// Allows the game to run logic such as updating the world,
68 /// checking for collisions, gathering input, and playing audio.
70 /// <param name="gameTime">Provides a snapshot of timing values.</param>
71 protected override void Update(GameTime gameTime)
73 if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
76 // TODO: Add your update logic here
78 InputController.UpdateInput();
79 ActorManager.Update(gameTime);
81 base.Update(gameTime);
85 /// This is called when the game should draw itself.
87 /// <param name="gameTime">Provides a snapshot of timing values.</param>
88 protected override void Draw(GameTime gameTime)
90 GraphicsDevice.Clear(Color.White);
94 ActorManager.Draw(spriteBatch);